using System;
using System.Collections.Generic;
using System.ByteBuffer;
using tools;

namespace thirteen
{
    /// <summary>
    /// generate by msg tool
    /// 十三张玩家结算信息
    /// </summary>
	public class RoundPlayerBillInfo : Dto
	{
		//玩家id
		public long playerId;
		//微信昵称
		public String nickName;
		//结算筹码(包含喜钱)
		public long cedit;
		//头墩牌型
		public int headCardsType;
		//头墩赢取
		public int headPoint;
		//头墩喜钱
		public int headLuckPoint;
		//头墩牌
		public List<int> headCards = new List<int>();
		
		//中墩牌型
		public int midCardsType;
		//中墩赢取
		public int midPoint;
		//中墩喜钱
		public int midLuckPoint;
		//中墩牌
		public List<int> midCards = new List<int>();
		
		//尾墩牌型
		public int tailCardsType;
		//尾墩赢取
		public int tailPoint;
		//尾墩喜钱
		public int tailLuckPoint;
		//尾墩牌
		public List<int> tailCards = new List<int>();
		

        public RoundPlayerBillInfo() { }

        public RoundPlayerBillInfo(long playerId, String nickName, long cedit, int headCardsType, int headPoint, int headLuckPoint, int midCardsType, int midPoint, int midLuckPoint, int tailCardsType, int tailPoint, int tailLuckPoint)
        {
            this.playerId = playerId;
            this.nickName = nickName;
            this.cedit = cedit;
            this.headCardsType = headCardsType;
            this.headPoint = headPoint;
            this.headLuckPoint = headLuckPoint;
            this.midCardsType = midCardsType;
            this.midPoint = midPoint;
            this.midLuckPoint = midLuckPoint;
            this.tailCardsType = tailCardsType;
            this.tailPoint = tailPoint;
            this.tailLuckPoint = tailLuckPoint;
        }

        
		public void write(object obj)
		{
			ByteBuffer b = obj as ByteBuffer;
			b.PushLong(playerId);
			b.PushString(nickName);
			b.PushLong(cedit);
			b.PushInt(headCardsType);
			b.PushInt(headPoint);
			b.PushInt(headLuckPoint);
			b.PushInt(headCards.Count);

			foreach (var element in headCards)
			{
				b.PushInt(element);
				
			}
			b.PushInt(midCardsType);
			b.PushInt(midPoint);
			b.PushInt(midLuckPoint);
			b.PushInt(midCards.Count);

			foreach (var element in midCards)
			{
				b.PushInt(element);
				
			}
			b.PushInt(tailCardsType);
			b.PushInt(tailPoint);
			b.PushInt(tailLuckPoint);
			b.PushInt(tailCards.Count);

			foreach (var element in tailCards)
			{
				b.PushInt(element);
				
			}
			
		}

	    public void read(object obj)
		{
		    MyConverter b = obj as MyConverter;
			playerId = b.toInt64();
			nickName = b.toString();
			cedit = b.toInt64();
			headCardsType = b.toInt32();
			headPoint = b.toInt32();
			headLuckPoint = b.toInt32();
			int headCards_length = b.toInt32();
			for (int i = 0; i < headCards_length; ++i)
			{
				headCards.Add(b.toInt32());
				
			}
			midCardsType = b.toInt32();
			midPoint = b.toInt32();
			midLuckPoint = b.toInt32();
			int midCards_length = b.toInt32();
			for (int i = 0; i < midCards_length; ++i)
			{
				midCards.Add(b.toInt32());
				
			}
			tailCardsType = b.toInt32();
			tailPoint = b.toInt32();
			tailLuckPoint = b.toInt32();
			int tailCards_length = b.toInt32();
			for (int i = 0; i < tailCards_length; ++i)
			{
				tailCards.Add(b.toInt32());
				
			}
			
		}

	}
}